<!-- 
  选项式API下生命周期钩子函数有 10 个
  组合式API下生命周期钩子函数有 8 个


  beforeCreate                  setup
  created                       setup
  beforeMount                   onBeforeMount
  mounted                       onMounted
  beforeUpdate                  onBeforeUpdate
  updated                       onUpdated
  beforeUnmount                 onBeforeUnmount
  unmounted                     onUnmounted
  activated                     onActivated
  deActivated                   onDeActivated


  组合式API生命周期钩子与选项式生命周期有何区别：

    1. 个数区别：组合式没有创建阶段，创建阶段就是 setup 阶段
    2. 写法区别：组合式全部都有一个 on 开头
        onMounted(() => {})
    3. 编写次数区别：
        选项式不能有同名的钩子
        组合式可以注册多个同名钩子

 -->

<template>
  <div>
    <h1>组合式下的生命周期钩子</h1>
  </div>
</template>

<script>
import { onMounted } from 'vue'

export default {
  setup() {
    onMounted(() => {
      console.log('mounted 1')
    })

    onMounted(() => {
      console.log('mounted 2')
    })
  }

  // mounted() {
  //   console.log('mounted 1')
  // },
  // mounted() {
  //   console.log('mounted 2')
  // }
}
</script>
